const conn = require("../data");

module.exports.article = (req, res) => {
  conn.query(
    `select * from page_news where page_options_id = ? order by clickrate desc limit 10;
  select * from page_news where page_options_id = ? order by clickrate desc limit 10;`,
    [req.query.id_a, req.query.id_b],
    (error, data) => {
      if (error) return console.log(error);
      return res.json(data);
    }
  );
};

module.exports.article_footer = (req, res) => {
  conn.query(
    `select * from page_news where page_options_id in (?) order by page_options_id limit 12;
  select * from page_news where page_options_id in (?) order by page_options_id limit 4`,
    [req.query.id_a, req.query.id_b],
    (error, data) => {
      if (error) return console.log(error);
      res.json(data);
    }
  );
};
